/*
 * cmdline_parser.h
 *
 *  Created on: 22 Feb 2012
 *      Author: simon
 */

#ifndef CMDLINE_PARSER_H_
#define CMDLINE_PARSER_H_

#include <iostream>
#include <list>
#include <string>

#include <boost/program_options.hpp>

//---------------------------------------------------------------------------//
class cmdline_parser
{
public:
    //-----------------------------------------------------------------------//
	// Constructor
	cmdline_parser(void);

	// Member function that parses command line options
	bool process_cmdline(int argc, char * argv[]);
	// Return the input PGM filename
	std::string get_input_filename(void) const;
	// Return the lightening output PGM filename
	std::string get_lighten_filename(void) const;
	// Return the darkening output PGM filename
	std::string get_darken_filename(void) const;
	// Return the invert output PGM filename
	std::string get_invert_filename(void) const;
	// Get the lighten amount
	int get_lighten_amount(void);
	// Get the darken amount
	int get_darken_amount(void);
	// Should we lighten?
	bool should_lighten(void);
	// Should we darken?
	bool should_darken(void);
	// Should we invert?
	bool should_invert(void);

	void print_errors(std::ostream & out) const;

	bool should_print_help(void) const;
	// Output help to the specified output stream
	void print_help(std::ostream & out) const;

private:
    //-----------------------------------------------------------------------//
	// Member variables
	boost::program_options::variables_map vm;
	boost::program_options::options_description od;
	std::list<std::string> errors;

    //-----------------------------------------------------------------------//
	// Static string variables
	static const std::string INPUTFILE;
	static const std::string DARKENFILE;
	static const std::string DARKENAMOUNT;
	static const std::string LIGHTENFILE;
	static const std::string LIGHTENAMOUNT;
	static const std::string INVERTFILE;
};

#endif /* CMDLINE_PARSER_H_ */
